package com.hwadee.caixiang.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hwadee.caixiang.dao.LoginMapper;
import com.hwadee.caixiang.dao.ForgotPwdMapper;
import com.hwadee.caixiang.entity.User;
import com.hwadee.caixiang.service.ForgotPwdService;

@Service("forgotPwdService")
public class ForgotPwdServiceImpl implements ForgotPwdService{
	@Autowired
	private ForgotPwdMapper forgotpwdMapper;
	
	@Override
	public User forgot(String username, String email) {
		User user = forgotpwdMapper.findPwdByUsername(username); 
		if( null == user || ! email.equals( user.getEmail()) ) {
			//throw new RuntimeException("用户名或密码错误!");
			return null;
		}
		else
			return user;
	}
 
}
